package factory.simple;

import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.util.Date;

/**
 * @author yi qiang
 * @date 2021/5/3 15:34
 */
public class OrderPizza {

    public OrderPizza(){
        Pizza pizza=null;
        do{
            String orderType=getType();
            if("cheese".equals(orderType)){
                pizza=new CheesePizza();
                pizza.setName("奶酪");
            }else
            if("greek".equals(orderType)){
                pizza=new GreekPizza();
                pizza.setName("希腊");
            }else {
                break;
            }
            pizza.prepare();
            pizza.bake();
            pizza.cut();
            pizza.box();
        }while (true);

    }

    private String getType(){
        try{
            BufferedReader reader=new BufferedReader(new InputStreamReader(System.in));
            return reader.readLine();
        }catch (Exception e){
            e.printStackTrace();
            return "";
        }
    }
}
